Cleanup, Tests | MultipartIdentifier#3891
Conversation
These were always passed with the same, constant, value.
This tested a case which would never occur.
Also remove now-unnecessary test case.
Also remove a now-unnecessary test case.
Remove unnecessary IsWhitespace method. Replace always-true runtime checks against constant values with debug assertions.
This tested the exception thrown when limit is zero. This is always either 3 or 4.
…ional inclusion of MultipartIdentifier from FunctionalTests
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
paulmedynski
left a comment
There was a problem hiding this comment.
Another good move of some true unit tests, and valuable cleanup along the way. A few suggestions to improve the cleanup even more.
src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/MultipartIdentifier.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/MultipartIdentifier.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/MultipartIdentifier.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/MultipartIdentifier.cs
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/MultipartIdentifier.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft/Data/Common/MultipartIdentifierTests.cs
Outdated
Show resolved
Hide resolved
Eliminates some ambiguity between "name" and "identifier", "identifier part" or "property name".
|
Thanks @paulmedynski - I've just replied to the first round of review comments. |
|
This pull request has been marked as stale due to inactivity for more than 30 days. If you would like to keep this pull request open, please provide an update or respond to any comments. Otherwise, it will be closed automatically in 7 days. |
|
This PR is not stale. |
|
@edwardneal Can you address the conflicts, and then I'll kick the pipelines and re-review. |
|
Thanks @paulmedynski - conflicts are merged. |
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
paulmedynski
left a comment
There was a problem hiding this comment.
Great improvements, now looking for some wider unit test coverage
src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft/Data/Common/MultipartIdentifierTests.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft/Data/Common/MultipartIdentifierTests.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft/Data/Common/MultipartIdentifierTests.cs
Show resolved
Hide resolved
|
A few years ago I rewrote the multipart identifier class so that it no longer requires that it return string[] but can use a span or memory to contain the parse information and you can then extract the parts of the string that you want and write them to a stream or string as you need to. It looks like I never got around to PR'ing because there were more important things with higher impact in progress. Is there interest in a version which has lower possible allocations? |
Replace various test cases with a Theory-based approach. Widen code coverage, including cases for [], " and whitespace. Prove both cases for throwOnEmptyMultiPartIdentifier.
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3891 +/- ##
=========================================
+ Coverage 0 64.75% +64.75%
=========================================
Files 0 282 +282
Lines 0 66045 +66045
=========================================
+ Hits 0 42765 +42765
- Misses 0 23280 +23280
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@Wraith2 - Yes, please open a PR with your changes! |
Description
This work performs a small cleanup of the MultipartIdentifier type, and moves its test into the UnitTests project. That simplifies some of the tech debt identified in #3890, since we can use InternalsVisibleTo to access the type directly rather than manually include the source file.
This can be reviewed commit-by-commit - I don't expect any behavioural changes. There's existing test coverage, and this passes, but everything can be verified statically. These changes essentially remove parameters which are always constant, but which were passed as a result of the MultipartIdentifier type being originally used for providers other than SqlClient.
Issues
None, but dovetails with #3890 - @benrr101 for awareness.
Testing
Existing automatic tests cover this.